/***************************************************************************
 *   Copyright (C) 2007 by Grzegorz Latarowski                             *
 *   g.latarowski@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef GPROPERTYEDITOR_H
#define GPROPERTYEDITOR_H


// Qt
#include <QtGui>
#include <QtCore>

// gcommon
#include "gparams.h"
#include "gparamdescription.h"

// local
#include "gitemdelegate.h"


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
class GPropertyEditor : public QTableView
{
	Q_OBJECT
			
public:
	// ====================================================
	// constructors/destructors
	
	GPropertyEditor( QWidget * pParent = 0 );
	virtual ~GPropertyEditor() {}

	// ====================================================
	// property editor specific
	virtual void setParamsDescription( const GParamsDescription & paramsDescription );

	GParams params();
	void setParams( const GParams & params );
	
	GItemDelegate * createItemDelegate( const GParamDescription & description );
	
public slots:
	virtual void setupTable();
	
signals:
	/// Emited whenever any item in the model was changed.
	void itemChanged();
	
private:
	QStandardItemModel * _pModel;

	GParamsDescription   _paramsDescription;
	QMap< int, QString > _paramsRowMap;
	GParams              _params;
	
}; // !GPropertyEditor
// ---------------------------------------------------------------------------




#endif // !GPROPERTYEDITOR_H

// eof
